home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / PInterfaces / QuickdrawText.p < prev    next >
Encoding:
Text File  |  1995-07-06  |  8.4 KB  |  263 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        QuickdrawText.p
  3.  
  4.      Contains:    QuickDraw Text Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT QuickdrawText;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __QUICKDRAWTEXT__}
  30. {$SETC __QUICKDRAWTEXT__ := 1}
  31.  
  32. {$I+}
  33. {$SETC QuickdrawTextIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$IFC UNDEFINED __MIXEDMODE__}
  43. {$I MixedMode.p}
  44. {$ENDC}
  45.  
  46. {$PUSH}
  47. {$ALIGN MAC68K}
  48. {$LibExport+}
  49.  
  50. CONST
  51. { CharToPixel directions }
  52.     leftCaret                    = 0;                            {Place caret for left block}
  53.     rightCaret                    = -1;                            {Place caret for right block}
  54.     hilite                        = 1;                            {Direction is SysDirection}
  55.     smLeftCaret                    = 0;                            {Place caret for left block - obsolete }
  56.     smRightCaret                = -1;                            {Place caret for right block - obsolete }
  57.     smHilite                    = 1;                            {Direction is TESysJust - obsolete }
  58. {Constants for styleRunPosition argument in PortionLine, DrawJustified,
  59.  MeasureJustified, CharToPixel, and PixelToChar.}
  60.     onlyStyleRun                = 0;                            { This is the only style run on the line }
  61.     leftStyleRun                = 1;                            { This is leftmost of multiple style runs on the line }
  62.     rightStyleRun                = 2;                            { This is rightmost of multiple style runs on the line }
  63.     middleStyleRun                = 3;                            { There are multiple style runs on the line and this 
  64.  is neither the leftmost nor the rightmost. }
  65.     smOnlyStyleRun                = 0;                            { obsolete }
  66.     smLeftStyleRun                = 1;                            { obsolete }
  67.     smRightStyleRun                = 2;                            { obsolete }
  68.     smMiddleStyleRun            = 3;                            { obsolete }
  69.  
  70. { type for styleRunPosition parameter in PixelToChar etc. }
  71.     
  72. TYPE
  73.     JustStyleCode = INTEGER;
  74.  
  75.     FormatOrder = ARRAY [0..0] OF INTEGER;
  76.  
  77.     FormatOrderPtr = ^FormatOrder;
  78.  
  79.     OffPair = RECORD
  80.         offFirst:                INTEGER;
  81.         offSecond:                INTEGER;
  82.     END;
  83.  
  84.     OffsetTable = ARRAY [0..2] OF OffPair;
  85.  
  86.     StyleRunDirectionProcPtr = ProcPtr;  { FUNCTION StyleRunDirection(styleRunIndex: INTEGER; dirParam: UNIV Ptr): BOOLEAN; }
  87.     StyleRunDirectionUPP = UniversalProcPtr;
  88.  
  89. CONST
  90.     uppStyleRunDirectionProcInfo = $00000390; { FUNCTION (2 byte param, 4 byte param): 1 byte result; }
  91.  
  92. FUNCTION NewStyleRunDirectionProc(userRoutine: StyleRunDirectionProcPtr): StyleRunDirectionUPP;
  93.     {$IFC NOT GENERATINGCFM }
  94.     INLINE $2E9F;
  95.     {$ENDC}
  96.  
  97. FUNCTION CallStyleRunDirectionProc(styleRunIndex: INTEGER; dirParam: UNIV Ptr; userRoutine: StyleRunDirectionUPP): BOOLEAN;
  98.     {$IFC NOT GENERATINGCFM}
  99.     INLINE $205F, $4E90;
  100.     {$ENDC}
  101.  
  102. FUNCTION Pixel2Char(textBuf: Ptr; textLen: INTEGER; slop: INTEGER; pixelWidth: INTEGER; VAR leadingEdge: BOOLEAN): INTEGER;
  103.     {$IFC NOT GENERATINGCFM}
  104.     INLINE $2F3C, $820E, $0014, $A8B5;
  105.     {$ENDC}
  106. FUNCTION Char2Pixel(textBuf: Ptr; textLen: INTEGER; slop: INTEGER; offset: INTEGER; direction: INTEGER): INTEGER;
  107.     {$IFC NOT GENERATINGCFM}
  108.     INLINE $2F3C, $820C, $0016, $A8B5;
  109.     {$ENDC}
  110. FUNCTION PixelToChar(textBuf: Ptr; textLength: LONGINT; slop: Fixed; pixelWidth: Fixed; VAR leadingEdge: BOOLEAN; VAR widthRemaining: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  111.     {$IFC NOT GENERATINGCFM}
  112.     INLINE $2F3C, $8222, $002E, $A8B5;
  113.     {$ENDC}
  114. FUNCTION CharToPixel(textBuf: Ptr; textLength: LONGINT; slop: Fixed; offset: LONGINT; direction: INTEGER; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  115.     {$IFC NOT GENERATINGCFM}
  116.     INLINE $2F3C, $821C, $0030, $A8B5;
  117.     {$ENDC}
  118. PROCEDURE DrawJustified(textPtr: Ptr; textLength: LONGINT; slop: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  119.     {$IFC NOT GENERATINGCFM}
  120.     INLINE $2F3C, $8016, $0032, $A8B5;
  121.     {$ENDC}
  122. PROCEDURE MeasureJustified(textPtr: Ptr; textLength: LONGINT; slop: Fixed; charLocs: Ptr; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  123.     {$IFC NOT GENERATINGCFM}
  124.     INLINE $2F3C, $801A, $0034, $A8B5;
  125.     {$ENDC}
  126. FUNCTION PortionLine(textPtr: Ptr; textLen: LONGINT; styleRunPosition: JustStyleCode; numer: Point; denom: Point): Fixed;
  127.     {$IFC NOT GENERATINGCFM}
  128.     INLINE $2F3C, $8412, $0036, $A8B5;
  129.     {$ENDC}
  130. PROCEDURE HiliteText(textPtr: Ptr; textLength: INTEGER; firstOffset: INTEGER; secondOffset: INTEGER; VAR offsets: OffsetTable);
  131.     {$IFC NOT GENERATINGCFM}
  132.     INLINE $2F3C, $800E, $001C, $A8B5;
  133.     {$ENDC}
  134. PROCEDURE DrawJust(textPtr: Ptr; textLength: INTEGER; slop: INTEGER);
  135.     {$IFC NOT GENERATINGCFM}
  136.     INLINE $2F3C, $8008, $001E, $A8B5;
  137.     {$ENDC}
  138. PROCEDURE MeasureJust(textPtr: Ptr; textLength: INTEGER; slop: INTEGER; charLocs: Ptr);
  139.     {$IFC NOT GENERATINGCFM}
  140.     INLINE $2F3C, $800C, $0020, $A8B5;
  141.     {$ENDC}
  142. FUNCTION PortionText(textPtr: Ptr; textLength: LONGINT): Fixed;
  143.     {$IFC NOT GENERATINGCFM}
  144.     INLINE $2F3C, $8408, $0024, $A8B5;
  145.     {$ENDC}
  146. FUNCTION VisibleLength(textPtr: Ptr; textLength: LONGINT): LONGINT;
  147.     {$IFC NOT GENERATINGCFM}
  148.     INLINE $2F3C, $8408, $0028, $A8B5;
  149.     {$ENDC}
  150. PROCEDURE GetFormatOrder(ordering: FormatOrderPtr; firstFormat: INTEGER; lastFormat: INTEGER; lineRight: BOOLEAN; rlDirProc: StyleRunDirectionUPP; dirParam: Ptr);
  151.     {$IFC NOT GENERATINGCFM}
  152.     INLINE $2F3C, $8012, $FFFC, $A8B5;
  153.     {$ENDC}
  154. {$IFC OLDROUTINENAMES }
  155. FUNCTION NPixel2Char(textBuf: Ptr; textLength: LONGINT; slop: Fixed; pixelWidth: Fixed; VAR leadingEdge: BOOLEAN; VAR widthRemaining: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  156.     {$IFC NOT GENERATINGCFM}
  157.     INLINE $2F3C, $8222, $002E, $A8B5;
  158.     {$ENDC}
  159. FUNCTION NChar2Pixel(textBuf: Ptr; textLength: LONGINT; slop: Fixed; offset: LONGINT; direction: INTEGER; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  160.     {$IFC NOT GENERATINGCFM}
  161.     INLINE $2F3C, $821C, $0030, $A8B5;
  162.     {$ENDC}
  163. PROCEDURE NDrawJust(textPtr: Ptr; textLength: LONGINT; slop: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  164.     {$IFC NOT GENERATINGCFM}
  165.     INLINE $2F3C, $8016, $0032, $A8B5;
  166.     {$ENDC}
  167. PROCEDURE NMeasureJust(textPtr: Ptr; textLength: LONGINT; slop: Fixed; charLocs: Ptr; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  168.     {$IFC NOT GENERATINGCFM}
  169.     INLINE $2F3C, $801A, $0034, $A8B5;
  170.     {$ENDC}
  171. FUNCTION NPortionText(textPtr: Ptr; textLen: LONGINT; styleRunPosition: JustStyleCode; numer: Point; denom: Point): Fixed;
  172.     {$IFC NOT GENERATINGCFM}
  173.     INLINE $2F3C, $8412, $0036, $A8B5;
  174.     {$ENDC}
  175. {$ENDC}
  176.  
  177. TYPE
  178.     FontInfo = RECORD
  179.         ascent:                    INTEGER;
  180.         descent:                INTEGER;
  181.         widMax:                    INTEGER;
  182.         leading:                INTEGER;
  183.     END;
  184.  
  185.     FormatStatus = INTEGER;
  186.  
  187.  
  188. PROCEDURE TextFont(font: INTEGER);
  189.     {$IFC NOT GENERATINGCFM}
  190.     INLINE $A887;
  191.     {$ENDC}
  192. PROCEDURE TextFace(face: Style);
  193.     {$IFC NOT GENERATINGCFM}
  194.     INLINE $A888;
  195.     {$ENDC}
  196. PROCEDURE TextMode(mode: INTEGER);
  197.     {$IFC NOT GENERATINGCFM}
  198.     INLINE $A889;
  199.     {$ENDC}
  200. PROCEDURE TextSize(size: INTEGER);
  201.     {$IFC NOT GENERATINGCFM}
  202.     INLINE $A88A;
  203.     {$ENDC}
  204. PROCEDURE SpaceExtra(extra: Fixed);
  205.     {$IFC NOT GENERATINGCFM}
  206.     INLINE $A88E;
  207.     {$ENDC}
  208. PROCEDURE DrawChar(ch: CHAR);
  209.     {$IFC NOT GENERATINGCFM}
  210.     INLINE $A883;
  211.     {$ENDC}
  212. PROCEDURE DrawString(s: ConstStr255Param);
  213.     {$IFC NOT GENERATINGCFM}
  214.     INLINE $A884;
  215.     {$ENDC}
  216. PROCEDURE DrawText(textBuf: UNIV Ptr; firstByte: INTEGER; byteCount: INTEGER);
  217.     {$IFC NOT GENERATINGCFM}
  218.     INLINE $A885;
  219.     {$ENDC}
  220. FUNCTION CharWidth(ch: CHAR): INTEGER;
  221.     {$IFC NOT GENERATINGCFM}
  222.     INLINE $A88D;
  223.     {$ENDC}
  224. FUNCTION StringWidth(s: ConstStr255Param): INTEGER;
  225.     {$IFC NOT GENERATINGCFM}
  226.     INLINE $A88C;
  227.     {$ENDC}
  228. FUNCTION TextWidth(textBuf: UNIV Ptr; firstByte: INTEGER; byteCount: INTEGER): INTEGER;
  229.     {$IFC NOT GENERATINGCFM}
  230.     INLINE $A886;
  231.     {$ENDC}
  232. PROCEDURE MeasureText(count: INTEGER; textAddr: UNIV Ptr; charLocs: UNIV Ptr);
  233.     {$IFC NOT GENERATINGCFM}
  234.     INLINE $A837;
  235.     {$ENDC}
  236. PROCEDURE GetFontInfo(VAR info: FontInfo);
  237.     {$IFC NOT GENERATINGCFM}
  238.     INLINE $A88B;
  239.     {$ENDC}
  240. PROCEDURE CharExtra(extra: Fixed);
  241.     {$IFC NOT GENERATINGCFM}
  242.     INLINE $AA23;
  243.     {$ENDC}
  244. PROCEDURE StdText(count: INTEGER; textAddr: UNIV Ptr; numer: Point; denom: Point);
  245.     {$IFC NOT GENERATINGCFM}
  246.     INLINE $A882;
  247.     {$ENDC}
  248. FUNCTION StdTxMeas(byteCount: INTEGER; textAddr: UNIV Ptr; VAR numer: Point; VAR denom: Point; VAR info: FontInfo): INTEGER;
  249.     {$IFC NOT GENERATINGCFM}
  250.     INLINE $A8ED;
  251.     {$ENDC}
  252.  
  253. {$ALIGN RESET}
  254. {$POP}
  255.  
  256. {$SETC UsingIncludes := QuickdrawTextIncludes}
  257.  
  258. {$ENDC} {__QUICKDRAWTEXT__}
  259.  
  260. {$IFC NOT UsingIncludes}
  261.  END.
  262. {$ENDC}
  263.